import json

data = {}
data['李昊哲'] = 39
data['徐晓羽'] = 18
print(data.get('李昊哲', -1))
print(data.get('徐晓羽', -1))
# 将对象转为json格式字符串
json_str = json.dumps(data, ensure_ascii=False)
print(type(json_str))
print(json_str)
# 将对象序列化到磁盘上
with open(file='data.json', mode='w', encoding='utf-8') as f:
    json.dump(data, f, ensure_ascii=False)
